import pytest


@pytest.fixture(scope="module")
def login(request):
    username = request.param  # 从request中取传递过来的参数
    print(username)
    return username


test_data = ["username1", "username2"]


@pytest.mark.parametrize("login", test_data, indirect=True)
# 添加indirect=True参数是为了把login当成一个函数去执行，而不是一个参数
def test_login(login):
    a = login
    print(a)


if __name__ == '__main__':
    pytest.main("pytest -s -q")
